﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Slock.GameObjects.ActorComponents
{
    /// <summary>
    /// A small lightweight component that can add functionality to an actor
    /// </summary>
    public abstract class ActorComponent
    {
        private Actor owner;
        private bool enabled;
        /// <summary>
        /// The actor that owns this component
        /// </summary>
        /// <param name="owner"></param>
        public ActorComponent(ref Actor owner)
        { 
            this.owner = owner;
            this.enabled = true;
        }

        /// <summary>
        /// Updates component logic
        /// </summary>
        /// <param name="delta"></param>
        public virtual void Tick(float delta)
        { }

        /// <summary>
        /// Get the id of the actor who owns this component
        /// </summary>
        public int ID
        { get { return owner.ID; } }

        /// <summary>
        /// Get the actor that owns this component
        /// </summary>
        public Actor Owner
        {
            get { return owner; }
            set { owner = value; }
        }

        /// <summary>
        /// Get or set this component's enabled state
        /// </summary>
        public bool Enabled
        {
            get { return this.enabled; }
            set { this.enabled = value; }
        }

    }
}
